<?php
// 前后台登录验证 和 初始页
Route::group(['namespace' => 'Auth'], function () {
    Route::get('/', 'LoginController@index');
//    Route::post('/login', 'LoginController@userLogin');
//    Route::post('/logout', 'LoginController@userLogout');
//    Route::get('/login-status', 'LoginController@loginStatus');

    Route::get('/backend', 'LoginController@adminIndex');
    Route::post('/backend/login', 'LoginController@adminLogin');
    Route::post('/backend/logout', 'LoginController@adminLogout');
    Route::get('/backend/login-status', 'LoginController@adminLoginStatus');
});




// 前后台公共api
Route::group(['namespace' => 'Common', 'prefix' => '/api'], function () {
    Route::get('/qiniu/token', 'Apicontroller@uploadToken');
    Route::get('/doctor/list', 'Apicontroller@doctorlist');
    Route::post('/refresh-cache', 'Apicontroller@refreshCache');

    //---
    Route::get('captcha', function () {
        $captcha = new \Laravist\GeeCaptcha\GeeCaptcha('0f2a028c4556046eaacda1637846dba6', 'ab8ab1ceca5d9205bce59bb9baea8fed');

        return  $captcha->GTServerIsNormal();
    });
    Route::post('find', 'PhoneController@find');
    Route::post('phone/send/', 'PhoneController@send');//发送短信
    Route::post('register/', 'PhoneController@register');//注册用户

});




// 后台
Route::group(['namespace' => 'Backend', 'prefix' => 'backend', 'middleware' => 'auth.admin'], function () {
    // 公共模块
    Route::get('/index', 'IndexController@index');
    Route::post('/refresh-cache', 'IndexController@refreshCache');

    // 管理员模块
    Route::resource('admins', 'AdminController');
    Route::post('admin/change-field-value/{id}', 'AdminController@changeFieldValue');

    //用户模块
    Route::resource('users', 'UserController');
    Route::get('/user/particulars/{id}', 'UserController@particulars');











    //套餐模块
    Route::resource('combos', 'ComboController');
    Route::post('combos/create', 'ComboController@create');
    Route::post('combos/destroy', 'ComboController@destroy');

    //评论模块
    Route::resource('comment', 'CommentController');
    Route::post('comment/create', 'CommentController@create');
    Route::post('comment/parameter', 'CommentController@parameter');
    Route::post('comment/branch', 'CommentController@branch');
    Route::post('comment/destroy', 'CommentController@destroy');

    //科目模块
    Route::resource('subject', 'SubjectController');
    Route::post('subject/create', 'SubjectController@create');
    Route::post('subject/update', 'SubjectController@update');

    //医生模块
    Route::resource('doctor', 'DoctorController');
    Route::post('doctor/create', 'DoctorController@create');
    Route::post('doctor/update', 'DoctorController@update');
    Route::post('doctor/destroy', 'DoctorController@destroy');

    //首页管理模块
    Route::resource('brand', 'BrandController');
    Route::post('brand/create', 'BrandController@create');

    //环境
    Route::resource('environment', 'EnvironmentController');
    Route::post('environment/create', 'EnvironmentController@create');
    Route::post('environment/destroy', 'EnvironmentController@destroy');



});
